#include <stdio.h>
int convertTo10(int n, int y){
	if(y==10) return n; 
	int sum = 0;
	int u = 1; 
	while(n>0){
		sum += (n%10)*u;
		n = int(n/10); 
		u *= y;
	} 
	return sum;
}
 
int main(){
	int m,n,x,y;
	scanf("%d%d%d%d",&m,&n,&x,&y);
	int u = convertTo10(m,n);
	int v = convertTo10(x,y);
	if(u<v)
		printf("The first number is smaller.");	
	else if(u>v)
		printf("The first number is bigger.");
	else
		printf("These two numbers are equal.");		
}
